﻿using Bll;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Myproject.BSM.PcWeb.PcChannel.Agency
{
    public partial class AgencyEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string ID = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(ID))
            {
                pc_Channel_AgencyEdit_AgencyId.Value = ID;
                AgencyModel model = new AgencyBLL().GetModel(Int32.Parse(ID));
                pc_Channel_AgencyEdit_AgencyClassID.Value = model.AgencyClassID.ToString();
                pc_Channel_AgencyEdit_AgencyClassName.Value = new AgencyClassBLL().GetModel(model.AgencyClassID).AgencyClassName;
                pc_Channel_AgencyEdit_Area.Value = model.Area.ToString();
                pc_Channel_AgencyEdit_Agencyname.Value = model.AgencyName;
                pc_Channel_AgencyEdit_AgencyNo.Value = model.AgencyNo;
                pc_Channel_AgencyEdit_wechar.Value = model.Wechar;
                pc_Channel_AgencyEdit_phone.Value = model.Phone;
            }
            else
            {
                string cID = Request.QueryString["cid"];
                if (!string.IsNullOrEmpty(cID))
                {
                    AgencyClassModel model = new AgencyClassBLL().GetModel(Int32.Parse(cID));
                    pc_Channel_AgencyEdit_AgencyClassID.Value = cID;
                    pc_Channel_AgencyEdit_AgencyClassName.Value = model.AgencyClassName;
                }
            }
        }
    }
}